<% crlf=CHR(13)+CHR(10) SET CENTURY ON m_transid=orequest.form('thetransid') if isnull(m_transid) m_transid=orequest.querystring('t') endif *theuser=orequest.querystring('user') m_transid=allt(transform(m_transid)) pagetype=lower(transform(orequest.querystring('pw'))) * 80mm * * * * * *@page {size: | auto | [ || [ landscape | portrait ] ]} do case case [mix] $ pagetype isurdu=2 case [local] $ pagetype isurdu=1 OTHER isurdu=0 endcase do case case pagetype='pos' pagewidth='80mm' pageheight='3276mm' case pagetype='a4' pagewidth='8.3inch' pageheight='11.7inch' case pagetype='a5' pagewidth='5.8inch' pageheight='8.3inch' case pagetype='a6' pagewidth='4.1inch' pageheight='5.8inch' OTHER pagewidth='8.3inch' pageheight='11.7inch' endcase theuser=[] tsql=[select top 1 *,IIF(VAL(transid)=0,VAL(SUBSTR(transid,2)),VAL(transid)) AS VTR, ] tsql=tsql+[ padl(allt(transid),9) as ptransid ] tsql=tsql+[ from ("]+dbclocation+'bill.dbf'+[") order by vtr desc, ptransid desc where allt(transid)==']+allt(m_transid)+[' into cursor test] &tsql SCATTER NAME SearchResults if TYPE('SearchResults.fbrinv')='C' and not ALLTRIM(SearchResults.fbrinv)=='0' and not EMPTY(SearchResults.fbrinv) fbrnumberreceived=allt(searchresults.fbrinv) else fbrnumberreceived=[] endif if empty(date) thedatestring=date() &&transform(date()) else thedatestring=date &&transform(dtoc(date)) endif openingbalance=[] if BETWEEN(val(left(SearchResults.vendor,2)),1,8) and left(SearchResults.vendor,3)<>'019' select sum(debit-credit) as dayopening from (dbclocation+[acctran]) where accountid=SearchResults.vendor and date]+ALLTRIM(accounts.name)+[] =SEEK(SearchResults.vendor,[accounts],[accountid]) cdebitor=[] invnum=m_transid &&searchresults.transid ************* USE IN SELECT('printinvoice') *SELECT x.transid, x.bill, x.date, x.dtime, x.ddate, x.vendor, x.gtotal, x.saleman,; * x.name, x.discount, x.payment, x.user, x.expac, x.expamt, x.cashpmt, ; *FROM (dbclocation+[bill]) x ; *left join (dbclocation+[billdata]) y on (x.transid=y.transid) ; *where x.transid=InvNum usesafe('itemmast') tsql=[Select x.transid, x.dtime, x.Name As Memo, x.user as operator, x.bill, x.Date, x.vendor,x.total as prdtotal, x.discount As prdDisc, ] tsql=tsql+[x.ddate, x.address1, x.address2, x.SaleMan,Y.ac,Y.Name,Y.phone, y.accountid, Y.fax, ] tsql=tsql+iif(xcompany.zunit=.t.,'z.unit','space(2)')+[ as zunit, ] + iif(xcompany.zctn=.t.,'z.ctn','space(2)')+[ as zctn, ] tsql=tsql+[z.ItemID, z.Batch, z.Desc, z.sr_no, z.packing, z.qty, z.bonus, z.rate, z.discount, z.Total, ]+ iif(xcompany.ismedical=.t.,'z.pdisc1','0')+[ as pdisc1, ] tsql=tsql+iif(xcompany.ismedical=.t.,'z.pdisc2','0')+[ as pdisc2, ] tsql=tsql+[z.expiry, z.sale, a.name as storename, z.tax1, z.tax2 ] tsql=tsql+[FROM (']+dbclocation+[bill') x LEFT join (']+dbclocation+[ACCOUNTS') Y ON (x.vendor=y.accountid) ] tsql=tsql+[LEFT JOIN (']+dbclocation+[billdata') z ON (x.transid=z.transid) LEFT join (']+dbclocation+[storemast') a ON (z.store=a.store) ] tsql=tsql+[WHERE allt(x.transid)==']+invnum+[' Order By z.transid, x.Date, z.sr_no INTO cursor ('printinvoice') readwrite ] &tsql =changeFieldStruc() IF EMPTY(memo) AND vendor<>[019] replace ALL memo WITH thedeposited ENDIF thevendordetails=allt(accountid)+[: ]+allt(name)+[ ]+allt(phone) ***** if not empty(openingbalance) tfile=addbs(oprop.appstartpath)+'images\receiptbarcode.bmp' SET PROCEDURE TO (addbs(oprop.appstartpath)+"FoxBarcodeQR.fxp") ADDITIVE set path to (addbs(oprop.appstartpath)) additive *--- Create FoxBarcodeQR object and QR Code barcode image LOCAL loFbc, lcQRImage m.loFbc = CREATEOBJECT("FoxBarcodeQR") *m.loFbc = NEWOBJECT("FoxBarcodeQR") m.lcString = allt(accountid)+[: ]+allt(name)+[ balance: ]+ openingbalance ERASE (tfile) m.lcQRImage = loFbc.FullQRCodeImage(lcString, tfile , 32*4) m.loFbc=.null. endif ***** XDISCLABEL=[] rept_saleman=[] hastax=.f. hasdiscount=.f. haszunit = .f. haszctn = .f. haskglibs=xcompany.usekglibs haspdisc1=.f. haspdisc2=.f. hasbonus=.f. hasexpiry=.f. hasbatch=.f. SCAN =seek(itemid,[itemmast],[itemid]) if xcompany.usekglibs and not (empty(itemmast.kgs) and empty(itemmast.libs)) haskglibs=.t. endif if not empty(expiry) hasexpiry=.t. endif if not empty(batch) hasbatch=.t. endif if not empty(pdisc1) haspdisc1=.t. endif if not empty(pdisc2) haspdisc2=.t. endif if not empty(bonus) hasbonus=.t. endif if not empty(zunit) haszunit= .t. endif if not empty(zctn) haszctn= .t. endif if not empty(tax1) or not empty(tax2) hastax=.t. endif if not empty(discount) hasdiscount=.t. endif theuser=allt(operator) endscan go top FBRSERVICE=0 SERVICECHARGES=0 &&srvchgs TOTALAMOUNT=ROUND(Printinvoice.prdtotal+SERVICECHARGES,0) PRODUCTDISCOUNT=prdDisc MEMBERDISCOUNT=0 totaltax=0 netamount=ROUND(Printinvoice.prdtotal+Printinvoice.prdDISC-MEMBERDISCOUNT+SERVICECHARGES,0) cspan=1 ************* %>

<%=xcompany.name%><%=iif(empty(xcompany.ntn),'',[NTN: ]+allt(xcompany.ntn))%>

<%=allt(allt(xcompany.address1)+[ ]+allt(xcompany.address2))%> <%=allt(allt(xcompany.phone)+[ ]+allt(xcompany.email))%>

VENDOR:

<%=thevendordetails%>

<%if hasbatch%> <%endif%> <%if hasexpiry%> <%endif%> <%if haskglibs%> <%else%> <%if haszctn%> <%endif%> <%if haszunit%> <%endif%> <%if hasbonus%> <%endif%> <%endif haskglibs%> <%if hastax=.t.%> <%endif%> <%if haspdisc1%> <%endif%> <%if haspdisc2%> <%endif%> <%if hasdiscount%> <%endif%> <%SCAN%> <% =seek(itemid,[itemmast],[itemid]) taxprate=itemmast.taxprate taxrate=itemmast.taxrate if haskglibs kgs=itemmast.kgs libs=itemmast.libs else kgs=0 libs=0 endif ITEMTX=round(iif(empty(taxprate),taxrate*qty,(qty*rate)-(qty*rate)/(1+taxprate/100)),2) if empty(taxprate) thetaxprate=round((taxrate/(rate-taxrate))*100,2) else thetaxprate=taxprate endif SALEINCLUDINGTAX=qty*rate saleexcludingtax=saleincludingtax-itemtx totaltax=totaltax+itemtx thechars=[] textra=allt(nvl(itemmast.extra,'')) for i=1 to len(textra) thechars=thechars+[ | ]+subst(textra,i,1)+[ : ]+transform(asc(subst(textra,i,1))) endfor testunits=nvl(zunit,0) kgqty=QTY*iif(empty(KGS),1,kgs) libsqty=QTY*iif(empty(libs),2.20462,libs) kgqty=icase(kgqty=round(kgqty,0),round(kgqty,0),kgqty=round(kgqty,2),round(kgqty,2),kgqty=round(kgqty,3),round(kgqty,3),round(kgqty,4)) libsqty=icase(libsqty=round(libsqty,0),round(libsqty,0),libsqty=round(libsqty,2),round(libsqty,2),libsqty=round(libsqty,3),round(libsqty,3),round(libsqty,4)) rateperlib=saleexcludingtax/libsqty if haskglibs if empty(kgs) thectnqty=iif(empty(testunits),qty,testunits) else thectnqty=qty endif rateperkg=saleexcludingtax/kgqty else thectnqty=qty rateperkg=saleexcludingtax/qty rateperkg=saleincludingtax/qty endif rateperkg=icase(rateperkg=round(rateperkg,0),round(rateperkg,0),round(rateperkg,2)) rateperlib=icase(rateperlib=round(rateperlib,0),round(rateperlib,0),round(rateperlib,2)) %> <%if hasbatch%> <%endif%> <%if hasexpiry%> <%endif%> <%if haskglibs%> <%else%> <%if haszctn%> <%endif%> <%if haszunit%> <%endif%> <%if hasbonus%> <%endif%> <%endif haskglibs%> <%if hastax=.t.%> <%endif%> <% roundeddisc=icase(discount=round(discount,0),round(discount,0),round(discount,2)) %> <%if haspdisc1%> <%endif%> <%if haspdisc2%> <%endif%> <%if hasdiscount%> <%endif%> <%ENDSCAN%> <% cspan=1 %> <%if not empty(openingbalance)%>

CREDIT PURCHASE BILL

<%if not empty(fbrnumberreceived)%>

<%endif%> <%if type([searchresults.fbrinv])=[C] and not empty(searchresults.fbrinv)%>

<%=[POSID# ]+ALLT(xcompany.fbrposid)%> <%=[FBR# ]+ALLT(fbrinv)%>

<%endif%> <%if not empty(memo)%>

<%=allt(memo)%>

<%endif%>

<%=[PUR# ]+ALLT(TRANSID)+[ DATE: ]+dtoc(date)+iif(empty(bill),[],[ BILL: ]+allt(bill))%>

# DETAILSBatchexpiryKGs LIBs CTNs RATE/LIB RATE/KGUNITPCSQTYBONUSRATETAX VATTOTALDisc
ON Sale
Disc
NET
DISC NET AMOUNT
<%=RECNO()%> <%=icase(isurdu=2,allt(DESC)+iif(empty(textra),[],[
]+allt(textra)),isurdu=1,iif(empty(textra),allt(desc),allt(textra)),allt(desc))%>
<%=iif(empty(batch),' ',transform(batch))%><%=iif(empty(expiry),' ',transform(expiry))%><%=iif(empty(KGQTY),' ',KGQTY)%> <%=iif(empty(libsQTY),' ',libsQTY)%> <%=iif(empty(thectnqty),' ',thectnqty)%> <%=iif(empty(rateperlib),' ',rateperlib)%> <%=iif(empty(rateperkg),' ',rateperkg)%><%=zctn%><%=iif(empty(thectnqty),' ',thectnqty)%><%=thectnqty%><%=iif(empty(bonus),' ',transform(bonus))%><%=rateperkg%><%=iif(empty(thetaxprate),' ',transform(thetaxprate)+[%])%> <%=iif(empty(itemtx),' ',transform(itemtx,'999999999.99'))%><%=ROUND(qty*rate,0)%><%=iif(empty(pdisc1),' ',transform(pdisc1)+'%')%><%=iif(empty(pdisc2),' ',transform(pdisc2)+'%')%><%=iif(empty(roundeddisc),' ',transform(roundeddisc))%> <%=ROUND(qty*rate-roundeddisc,0)%>
<%if hastax=.t.%> <%if totaltax<>0 %> <%endif%> <%endif%> <%if fbrservice<>0 %> <%endif%> <%if SERVICECHARGES<>0 %> <%endif%> <%if round(PRODUCTDISCOUNT+MEMBERDISCOUNT,2)<>0 %> <%endif%>
TOTAL TAX<%=transform(TOTALTAX,'99999999999999.99')%>
POS SERVICE CHARGES<%=transform(fbrservice,'99999999999999.99')%>
SERVICE CHARGES<%=transform(SERVICECHARGES,'99999999999999.99')%>
TOTAL AMOUNT<%=transform(TOTALAMOUNT+fbrservice+SERVICECHARGES,'99999999999999.99')%>
DISCOUNT<%=transform(PRODUCTDISCOUNT+MEMBERDISCOUNT,'99999999999999.99')%>
NET AMOUNT<%=transform(TOTALAMOUNT+fbrservice+SERVICECHARGES-PRODUCTDISCOUNT-MEMBERDISCOUNT,'99999999999999.99')%>
<%if not empty(nvl(closing.debits,0))%> <%endif%> <%if not empty(nvl(closing.Credits,0))%> <%endif%>
Opening<>
Add Debits<>
Less Credits<>
Closing Balance<>
<%endif%>

<%='OPERATOR '+ALLT(theuser)+' '+IIF(EMPTY(REPT_SALEMAN),'','SOLD BY: '+REPT_SALEMAN)%>